<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;

use App\Http\Model\User;
use App\Http\Model\Address;
use DB;

class AddressController extends Controller
{
    //
    public function addressList(){
    	$user = new User;
    	$userInfo = $user->get();
    	$userInfoHight = $user->select("user.*", DB::raw('count(address.id) as sum'))->leftJoin("address", "user.id", "=", "user_id")->groupBy("user_id")->orderBy("sum", "desc")->first();
    	return view("admin.address.addressList", ["userInfo"=>$userInfo, "userInfoHight"=>$userInfoHight]);
    }
}
